package com.hs.wa.test;

import com.hs.wa.uilt.SpringUilts;
import com.hs.wa.vo.Person;

import java.util.ArrayList;
import java.util.List;

public class Copy {

    public static void main(String[] args) {

        List<Person> a = new ArrayList<>();
        Person s = new Person();
        s.setId(1);
        s.setName("Alice");
        s.setAge(20);
        s.setCourses("Arrays.asList(");
        a.add(s);

        Person s2 = new Person();
        s2.setId(12);
        s2.setName("Alice2");
        s2.setAge(202);
        s2.setCourses("Arrays.asList(");
        a.add(s2);

        Person s3 = new Person();
        s3.setId(13);
        s3.setName("Alice3");
        s3.setAge(203);
        s3.setCourses("Arrays.asList(33");
        a.add(s3);

        Person st = new Person();
        Person st2 = new Person();
        Person st1 = new Person();

        for (int i = 0; i < a.size(); i++) {

            if (i == 0) {
                System.out.println(i +"start");

                SpringUilts.copyProperties(a.get(i), st);
                System.out.println("st  "+st);
                System.out.println("st1  "+st1);
                System.out.println("st1  "+st2);

            }

            if (i == 1) {
                System.out.println(i +"start");
                //st.setAge(999999);
                a.get(i).setAge(99999999);
                System.out.println("st  "+st);

                SpringUilts.copyProperties(a.get(i), st1);
                SpringUilts.copyProperties(a.get(i), st);

                System.out.println("st  "+st);
                System.out.println("st1  "+st1);
                System.out.println("st1  "+st2);

            }
            if (i == 2) {
                System.out.println(i +"start");

                SpringUilts.copyProperties(a.get(i), st2);

                System.out.println("st  "+st);
                System.out.println("st1  "+st1);
                System.out.println("st1  "+st2);

            }

        }


    }


}
